<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/html/axios.min.js"></script>
    <script src="/html/util.js"></script>
    <script>
        let config = {
            headers: {'Content-Type': 'multipart/form-data' }
        }

        function add(){
            var param = new FormData();
            param.append("userName",$("userName").value);
            param.append("face",$("imgFile").files[0]);

            axios.post("/user/upload",param,config).then(e => {
                alert(e.data);
            });
        }
    </script>
</head>
<body>
    姓名：<input type="text" id="userName"><br>
    头像：<img src="" id="faceImg" width="200" height="200"
     onchange="fileChange('imgFile','faceImg')"><br>
    <input type="file" id="imgFile"><br>
    <input type="button" onclick="add()">
</body>
</html>